<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:component xmlns="http://www.w3.org/1999/xhtml"
              xmlns:h="http://java.sun.com/jsf/html"      
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:p="http://primefaces.org/ui">

    <h:form id="formList" styleClass="jsfcrud_list_form">
        <h3><h:outputText value="#{bundle.TecnicoUsinaTitleRelacionamento}"/></h3>
        <h:panelGroup >

            <p:dataTable value="#{tecnicoUsinaController.lista}" var="item"  paginator="true" rows="10"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20" rowKey="#{item.tusId}" paginatorPosition="both" emptyMessage="#{bundle.ListTecnicoUsinaEmpty}" selection="#{tecnicoUsinaController.selectedTecnicoUsina}" selectionMode="single">

                <p:column styleClass="firstColumn" filterBy="#{item.tusId}" sortBy="#{item.tusId}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListTecnicoUsinaTitle_tusId}"/>
                    </f:facet>
                    <h:outputText value="#{item.tusId}"/>
                </p:column>
                <p:column filterBy="#{item.tusUsiId.usiNm}" sortBy="#{item.tusUsiId.usiNm}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListTecnicoUsinaTitle_tusUsiId}"/>
                    </f:facet>
                    <h:outputText value="#{item.tusUsiId.usiNm}"/>
                </p:column>
                <p:column filterBy="#{item.tusTecId.tecNm}" sortBy="#{item.tusTecId.tecNm}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListTecnicoUsinaTitle_tusTecId}"/>
                    </f:facet>
                    <h:outputText value="#{item.tusTecId.tecNm}"/>
                </p:column>

                <f:facet name="footer">
                    <p:commandButton id="createCommand" ajax="false" icon="ui-icon-document" action="#{tecnicoUsinaController.prepareCreate}" value="#{bundle.ListTecnicoUsinaCreateLink}"/>
                    <p:commandButton id="viewCommand" value="#{bundle.MsgVisualizar}" icon="ui-icon-search"  update=":formList:displayView" oncomplete="tecnicoUsinaDialogView.show()" />                   
                    <p:commandButton ajax="false" id="editCommand"  action="#{tecnicoUsinaController.prepareEdit}" value="#{bundle.ViewTecnicoUsinaEditLink}" icon="ui-icon-pencil" />
                    <p:commandButton id="deleteCommand"  onclick="confirmationDestroy.show()" value="#{bundle.ViewTecnicoUsinaDestroyLink}" type="button" icon="ui-icon-trash" />
                </f:facet>

            </p:dataTable>
            <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}" oncomplete="confirmationDestroy.hide();" actionListener="#{tecnicoUsinaController.destroy}" />
                <p:commandButton id="decline"  value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide()" type="button"/>

            </p:confirmDialog>

            <p:dialog id="dialogView" header="#{bundle.TecnicoUsinaDialogView_header}" widgetVar="tecnicoUsinaDialogView" resizable="false" width="500" >
                <h:panelGrid id="displayView" columns="2" cellpadding="4">                          
                    <h:outputText value="#{bundle.ViewTecnicoUsinaLabel_tusId}"/>
                    <h:outputText value="#{tecnicoUsinaController.selected.tusId}" title="#{bundle.ViewTecnicoUsinaTitle_tusId}"/>
                    <h:outputText value="#{bundle.ViewTecnicoUsinaLabel_tusUsiId}"/>
                    <h:outputText value="#{tecnicoUsinaController.selected.tusUsiId.usiNm}" title="#{bundle.ViewTecnicoUsinaTitle_tusUsiId}"/>
                    <h:outputText value="#{bundle.ViewTecnicoUsinaLabel_tusTecId}"/>
                    <h:outputText value="#{tecnicoUsinaController.selected.tusTecId.tecNm}" title="#{bundle.ViewTecnicoUsinaTitle_tusTecId}"/>
                </h:panelGrid>
            </p:dialog>
        </h:panelGroup>


    </h:form>
</ui:component>

